<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>用户管理</title>
    <link rel="icon" th:href="@{/public/admin/favicon.png}" type="image/png">
    <!--<link rel="stylesheet" th:href="@{/lib/element-ui/lib/theme-chalk/index.css}"/>-->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" th:href="@{/lib/font/css/font-awesome.min.css}"/>
    <link rel="stylesheet" th:href="@{/public/admin/base.css}">
    <link rel="stylesheet" th:href="@{/admin/css/account.css}">

    <!--[if lt IE 9]>
    <script src="//cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
    <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<!-- vue入口 -->
<div id="app">
    <!-- 布局容器 -->
    <div class="pull-height">
        <!-- aside -->
        <div th:replace="admin/side :: side"></div>

        <!-- container -->
        <el-container id="main" :class="{main_close:config.isCollapse}">
            <!-- header -->
            <div style="background-color: rgb(84, 92, 100);" th:replace="admin/header :: header"></div>

            <!-- main -->
            <el-main>
                <el-card>
                    <h2>用户管理</h2>
                    <!-- 添加框 -->
                    <el-card class="card-category">
                        <el-card class="card-tags">
                            <div slot="header">
                                <span>添加用户</span>
                            </div>
                            <div>
                                <el-form label-width="100px" :model="entity.add" ref="add">
                                    <el-form-item required prop="username"
                                                  :rules="[{ required: true, message: '请输入用户名称'}]"
                                                  label="用户名称">
                                        <el-input placeholder="请输入用户名称"
                                                  v-model="entity.add.username"></el-input>
                                    </el-form-item>
                                    <el-form-item required prop="nickname"
                                                  :rules="[{ required: false, message: '请输入用户昵称'}]"
                                                  label="用户昵称">
                                        <el-input placeholder="请输入用户昵称"
                                                  v-model="entity.add.nickname"></el-input>
                                    </el-form-item>
                                    <el-form-item required prop="email"
                                                  :rules="[{ required: true, message: '请输入用户邮箱'}]" label="用户邮箱">
                                        <el-input placeholder="请输入用户邮箱" v-model="entity.add.email"></el-input>
                                    </el-form-item>
                                    <el-form-item required prop="password"
                                                  :rules="[{ required: true, message: '请输入密码'}]" label="输入密码">
                                        <el-input placeholder="请输入密码,密码长度在6位及以上" v-model="entity.add.password"
                                                  type="password"></el-input>
                                    </el-form-item>
                                    <el-form-item required prop="confirm"
                                                  :rules="[{ required: true, message: '确认密码'}]" label="确认密码">
                                        <el-input placeholder="确认密码" v-model="entity.add.checkPass"
                                                  type="password"></el-input>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="danger" @click="addUser" style="float:right;">添加
                                        </el-button>
                                    </el-form-item>
                                </el-form>
                            </div>
                        </el-card>
                    </el-card>

                    <!-- 列表 -->
                    <el-table
                            ref="users"
                            :data="entity.users"
                            border
                            tooltip-effect="dark"
                            style="width: 100%"
                            @selection-change="selectChange">
                        <el-table-column
                                ref="selection"
                                align="center"
                                type="selection"
                                width="55">
                        </el-table-column>
                        <el-table-column
                                prop="id"
                                align="center"
                                sortable
                                fixed
                                label="用户ID"
                                show-overflow-tooltip
                                width="100">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="username"
                                label="用户名称"
                                width="150"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="nickname"
                                label="用户昵称"
                                width="150"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="password"
                                label="密码"
                                width="150"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="salt"
                                label="盐"
                                width="150"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="email"
                                label="电子邮箱"
                                width="150"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column label="操作" align="center" fixed="right">
                            <template slot-scope="scope">
                                <el-button
                                        icon="el-icon-delete"
                                        size="mini"
                                        type="danger"
                                        @click="handleDelete(scope.row.id)">删除
                                </el-button>
                                <el-button size="mini" icon="el-icon-edit" type="warning"
                                           @click="handleEdit(scope.row.id)">编辑
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <!-- 分页 -->
                    <div class="pagination">
                        <el-pagination
                                background
                                @size-change="handleSizeChange"
                                @current-change="handleCurrentChange"
                                :current-page="pageConf.pageCode"
                                :page-sizes="pageConf.pageOption"
                                :page-size="pageConf.pageSize"
                                layout="total, sizes, prev, pager, next, jumper"
                                :total="pageConf.totalPage">
                        </el-pagination>
                    </div>
                </el-card>
            </el-main>
        </el-container>
    </div>
</div>
</body>
<!--<script type="text/javascript" th:src="@{/lib/vue/vue.min.js}"></script>-->
<!--<script type="text/javascript" th:src="@{/lib/element-ui/lib/index.js}"></script>-->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script type="text/javascript" th:src="@{/lib/vue/vue-resource.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/account.js}"></script>
</html>